package wiki.kaizen.cloud.security.session.config;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.Map;

@RequestMapping("/kaizen")
@RestController
public class DefaultControllerConfig {

    @GetMapping("/login")
    public Map<String,Object> login(){
        return new HashMap<String,Object>(2){
            {
                put("code", HttpServletResponse.SC_UNAUTHORIZED);
                put("msg","需要重新登录");
            }
        };
    }

    @GetMapping("/unauthorized")
    public Map<String,Object> unauthorized(){
        return new HashMap<String,Object>(2){
            {
                put("code", HttpServletResponse.SC_FORBIDDEN);
                put("msg","权限不足");
            }
        };
    }
    @GetMapping("/kickout")
    public Map<String,Object> kickout() {
        return new HashMap<String, Object>(2) {
            {
                put("code", HttpServletResponse.SC_FORBIDDEN);
                put("msg", "您已被强制下线,该账号已在其他地方登陆.");
            }
        };
    }

    @GetMapping("/locked")
    public Map<String,Object> locked(){
        return new HashMap<String, Object>(2) {
            {
                put("code", HttpServletResponse.SC_FORBIDDEN);
                put("msg", "您的账号已被锁定.");
            }
        };
    }
}
